package com.roc.live;

import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

import com.roc.live.receiver.LiveReceiver;

public class LiveApplication extends Application {
    private static Context context;

    @Override
    public void onCreate() {
        super.onCreate();

        context = this;

//        startReceiver();
    }

    public static Context getAppContext() {
        return context;
    }

    private void startReceiver() {
        LiveReceiver liveReceiver = new LiveReceiver();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_BOOT_COMPLETED);
        intentFilter.addAction(Intent.ACTION_REBOOT);
        intentFilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);//锁屏
//        intentFilter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);//方向发生变化
        intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");

        registerReceiver(liveReceiver, intentFilter);
    }
}
